Skip to content

Feature/auth#2314

Open
GarrettBeatty wants to merge 3 commits intodevfrom
feature/auth
Open

Feature/auth#2314
GarrettBeatty wants to merge 3 commits intodevfrom
feature/auth

Conversation

@GarrettBeatty
Copy link
Contributor

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@GarrettBeatty GarrettBeatty marked this pull request as ready for review March 23, 2026 19:08
Copy link
Member

@normj normj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious about your thoughts. Right now the Authorizer attribute on the API function has to match the .NET method name. If the user sets the optional ResourceName on the LambdaFunction attribute on the authorizer function would it make sense that that is what the Authorizer should be set to?

    [LambdaFunction]
    [RestApi(LambdaHttpMethod.Get, "/secret", Authorizer = "MyAuthorizer")]
    public IHttpResult GetRestricted(ILambdaContext context)
    {
        return HttpResults.Ok("You access the restricted section");
    }

    [LambdaFunction(ResourceName = "MyAuthorizer")]
    [RestApiAuthorizer]
    public IAuthorizerResult Authorize([FromServices] IAuthorizationService auth, [FromHeader] string authorization, ILambdaContext context)


/// <summary>
/// Name of the HTTP API Lambda authorizer to protect this endpoint.
/// Must match the Name property of an <see cref="HttpApiAuthorizerAttribute"/> in this project.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs are out of date when we used to have a Name property. The doc should be updated to be clear this needs to be the name of the .NET method that will be the authorizer and recommend using the nameof operator.


/// <summary>
/// Name of the REST API Lambda authorizer to protect this endpoint.
/// Must match the Name property of a <see cref="RestApiAuthorizerAttribute"/> in this project.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs are out of date when we used to have a Name property. The doc should be updated to be clear this needs to be the name of the .NET method that will be the authorizer and recommend using the nameof operator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants